/*
 *  Copyright (c) 2019-2020, somewhere (somewhere0813@gmail.com).
 *  <p>
 *  Licensed under the GNU Lesser General Public License 3.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *  <p>
 * https://www.gnu.org/licenses/lgpl.html
 *  <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.shanhesoft.java.modules.tool.service;


import com.shanhesoft.java.common.persistence.service.BaseService;
import com.shanhesoft.java.modules.tool.domain.vo.Chunk;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

/**
 * @author somewhere
 * @since 2019/2/1
 */
public interface FileService extends BaseService<Chunk> {
	/**
	 * 获取文件列表
	 * @return 文件列表map
	 */
	public Map<String,String> getFileList();

	/**
	 * 文件下载业务
	 * 根据文件名查找文件列表对应文件的路径，将其写到response的输出流
	 * @param fileName 文件名
	 * @param request 请求
	 * @param response 响应
	 */
	public void fileDownload(String fileName, HttpServletRequest request, HttpServletResponse response);

	/**
	 * 处理POST请求（携带文件流）
	 * @param chunk 文件块
	 * @param response 响应
	 */
	public String fileUploadPost(Chunk chunk, HttpServletResponse response);

	/**
	 * 处理GET请求（携带文件流）
	 * @param chunk 文件块
	 * @param response 响应
	 * @return 文件块
	 */
	public void fileUploadGet(Chunk chunk, HttpServletResponse response);
}
